﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace E5_KhuyenMaiVang.Helper
{
    public static class Helper
    {
        public static MvcHtmlString MenuLink(this HtmlHelper htmlHelper, string linkText, string[] actionName, string controllerName)
        {            
            string currentAction = htmlHelper.ViewContext.RouteData.GetRequiredString("action");
            string currentController = htmlHelper.ViewContext.RouteData.GetRequiredString("controller");
            bool b = actionName.Contains(currentAction);
            if (b && controllerName == currentController)
            {
                return htmlHelper.ActionLink(linkText, actionName[0], controllerName, null, new { @class = "active" });
            }                            
            return htmlHelper.ActionLink(linkText, actionName[0], controllerName);           
        }
    }
}